package com.glory.cqaospda.adapter;


import android.util.Log;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.glory.cqaospda.R;
import com.glory.cqaospda.bean.MaintenanceBean;
import com.glory.cqaospda.bean.ProcessCheckBean;

import java.util.List;

import androidx.annotation.Nullable;

public class ProcessCheckAdapter extends BaseQuickAdapter<ProcessCheckBean.ItemList, BaseViewHolder> {

    private List<ProcessCheckBean.ItemList> datalist;
    private OnItemClickListener mOnItemClickListener;
    private Boolean islot;


    public ProcessCheckAdapter(@Nullable List<ProcessCheckBean.ItemList> data,Boolean isLot) {
        super(R.layout.adapter_processcheck, data);
        datalist = data;
        this.islot = isLot;
    }

    @Override
    protected void convert(BaseViewHolder helper, ProcessCheckBean.ItemList item) {

        helper.setText(R.id.tvTime, item.getMDateTime());
        helper.setText(R.id.tvReelID, item.getMReelID());
        helper.setText(R.id.tvLotID, item.getMLotNo());
        helper.setText(R.id.tvEquipmentName, item.getMEquipmentName());
        helper.setText(R.id.tvStart, "0".equals(item.getMState())? "待检" : "检查");

        helper.getView(R.id.tvStart).setOnClickListener(view -> {
            mOnItemClickListener.onItemClick(item,helper.getAdapterPosition());
        });

    }

    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }

    public interface OnItemClickListener {
        void onItemClick(ProcessCheckBean.ItemList itemList,int position);
    }

}
